import '@quasar/extras/material-icons/material-icons.css';
import './index.scss';
import Vue from 'vue';
import {convertCssLength} from '../../../util/common';
/**
 * 图标, 使用谷歌的material-icons
 * 函数式组件, 加快速度
 * @author 唐国雄
 * @date 2021/6/3
 * 属性----------------------
 * :name	图标名
 * :color	颜色
 * :size	大小
 */
export default Vue.extend({
	name:'Icon',
	functional:true,
	props:{
		name:String,
		color:String,
		size:[String,Number],
	},
	render(h,context){
		const {props:{name,color,size},data}=context;
		if(data.staticClass){
			data.staticClass='lexmis-Icon material-icons '+data.staticClass;
		}else{
			data.staticClass='lexmis-Icon material-icons';
		}
		const staticStyle=data.staticStyle||{};
		if(size!==undefined){
			staticStyle.fontSize=convertCssLength(size);
		}
		if(color){
			staticStyle.color=color;
		}
		data.staticStyle=staticStyle;
		return h('i',data,name);
	}
});
